<%@ page import="java.util.ArrayList"%>
<%@ page import="java.lang.reflect.Array"%>
<%@	page import="com.dao.Word,jspTools.*"%>
<%--
  Created by IntelliJ IDEA.
  User: THINKPAD
  Date: 2021/6/25
  Time: 17:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%--<base href="http://localhost:8080/other/">--%>
<html>
<head>
<jsp:useBean id="user" scope="session" class="jspTools.Test" />
<jsp:setProperty name="user" property="*" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="test.css" />
<script type="text/javascript" src="test.js"></script>
<title>测试部分2</title>
</head>
<body>
	<%
		String resultString = request.getParameter("result");
		String[] resultStringArray = resultString.split(",");
		boolean[] result = new boolean[resultStringArray.length];
		int index=0;
		for(String x : resultStringArray){
			if(x.equals("1")){
				result[index]=true;
			}
			else{
				result[index]=false;
			}
			index++;
		}
		
		Test t = (Test)session.getAttribute("test");
		Word[] words = t.getSecondPartQuiz(result);
		
	%>
	<%-- 初始化js数组 --%>
	<script type="text/javascript">
		var part=2;
		var w=[];
		<%for(int i=0;i<words.length;i++){%>
			w[<%=i%>]="<%=words[i].getWord()%>";
		<%}%>
		var quizLength=w.length;
		window.onload=function(){
			document.getElementById("quiz").innerHTML=w[0];
			document.getElementById("testedNum").innerHTML="已测试20个单词";
		}
	</script>
	<table class="page1">
		<tr>
			<td class="title1" id="quiz"></td>
		</tr>
		<tr>
			<td class="word1"><button onclick="know()">认识</button></td>
		</tr>
		<tr>
			<td class="word1"><button onclick="dontKnow()">不认识</button></td>
		</tr>

	</table>
	<div class="have" id="testedNum"></div>
</body>
</html>